package com.example.whereismystuff.classes;

import java.util.ArrayList;
import java.util.List;

public class User{
	private String username, password, email;
	private int m_nUniqueID = -1;
	protected ArrayList<Item> m_items;
	protected ArrayList<Integer> IDList;
	private boolean blocked = false, isAdmin = false;
	public boolean isBlocked() {
		return blocked;
	}

	public void setBlocked(boolean blocked) {
		this.blocked = blocked;
	}

	public User(){
	}
	
	public User(String username, String password, String email){
		this.username = username;
		this.password = password;
		this.email = email;
		m_items = new ArrayList<Item>();
	}
	
	public String getUserName(){
		return username;
	}//End method
	
	public void setUserName(String username){
		this.username = username;
	}//End method
	
	public String getPassword(){
		return password;
	}//End method
	
	public void setPassword(String password){
		this.password = password;
	}//End method
	
	public String getEmail(){
		return email;
	}//End method
	
	public void setEmail(String email){
		this.email = email;
	}//End method
	
	public int getUniqueID()
	{
		return m_nUniqueID;
	}
	public int getID()
	{
		return m_nUniqueID;
	}
	
	public void addItem(Item item)
	{
		m_items.add(item);
	}
	
	public List<Item> getItems()
	{
		return m_items;
	}
	public Item removeItem(Item item)
	{
		int nIndex = m_items.indexOf(item);
		
		if (nIndex == -1)
			return null;
		else
			return m_items.remove(nIndex);
	}
	public void setUniqueID(int value)
	{
		m_nUniqueID = value;
	}
	
	public String toString()
	{
		return "(" + username + ", " + email + ", password: " + password + ", #Items: " + m_items.size() + ")";
	}
	
	public void setLocked(boolean value)
	{
		blocked = value;
	}
	
	public boolean isLocked()
	{
		return blocked;
	}

	public boolean isAdmin() {
		return isAdmin;
	}

	public void setIsAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}
}